package com.zxy;

import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.Method;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;

import java.util.HashMap;
import java.util.Map;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients//作用：会扫描我们包里面所有带注解@FeignClient的接口，然后生成代理
//加上 @EnableDiscoveryClient 具有服务发现的功能
public class RibbonApp {

    public static void main(String[] args) {

        SpringApplication.run(RibbonApp.class, args);

        String url = "https://dfsns.market.alicloudapi.com/data/send_sms";

        String appcode = "3f19f71d01994629886250e3bf0552ca";

        int code = RandomUtil.randomInt(1000, 9999);
        String phone = "13721337351";
        HttpRequest httpRequest = HttpRequest.of(url)
                .method(Method.POST)
                .header("Authorization", "APPCODE " + appcode)
                .body(StrUtil.format("content=code:{}&template_id=TPL_0000&phone_number={}", code,phone));

        HttpResponse execute = httpRequest.execute();


    }

}
